﻿namespace Swimj.DataCore
{
    public partial interface IRepository<TEntity, in TKey> 
        where TEntity : class, new()
        where TKey : struct
    {
        TEntity Get(TKey key);

        Task<TEntity?> GetAsync(TKey key);

        Task<IEnumerable<TEntity>> QueryAllByOrderAsync(string order, string sort);

        Task<Tuple<IEnumerable<TEntity>, int>> QueryAllByPageAsync(int pageIndex, int pageSize);

        Task<Tuple<IEnumerable<TEntity>, int>> QueryAllByOrderPageAsync(string order, string sort,
            int pageIndex, int pageSize);

        Tuple<IEnumerable<TEntity>, int> QueryFilterByPage(ConditionCollection conditions,
            int pageIndex, int pageSize);

        Tuple<IEnumerable<TEntity>, int> QueryFilterByOrderPage(ConditionCollection conditions,
            string order, string sort, int pageIndex, int pageSize);

        Task<IEnumerable<TEntity>> QueryFilterAsync(ConditionCollection conditions);

        Task<IEnumerable<TEntity>> QueryFilterByOrderAsync(ConditionCollection conditions,
            string order, string sort);

        Task<Tuple<IEnumerable<TEntity>, int>> QueryFilterByPageAsync(ConditionCollection conditions,
            int pageIndex, int pageSize);

        Task<Tuple<IEnumerable<TEntity>, int>> QueryFilterByOrderPageAsync(ConditionCollection conditions,
            string order, string? sort, int pageIndex, int pageSize);
    }
}